/**
 * 检测数据类型
 */
export function dataTypes() {
  const type_fun = {};
  const types = [
    "Number",
    "String",
    "Boolean",
    "Array",
    "Function",
    "Null",
    "Undefained",
    "Set",
    "Map",
    "Object",
  ];
  types.forEach((item) => {
    const fun = `is${item}`;
    type_fun[fun] = (value) =>
      Object.prototype.toString.call(value) === `[object ${item}]`;
  });
  return type_fun;
}

/**
 * 根据字段获取控件的数据
 */
export function getControlByField(data, field){
  const control = data.filter(item => item.field === field)
  if(control.length) {
    return control[0]
  }
  return null
}